<?php
	session_start();
	require('../Model/mysql.php');
	require('../host_config.php');
	if ($_SESSION["flag"] != 2) {
		echo "<script language='javascript'>";
		echo "alert('You have no permission to read this page!');";
		echo "history.back();";
		echo "</script>";
		header("location:../login.php");
	}else {
		$mysql = new MySQL();
		$link = $mysql->connect($mysql_host, $mysql_user, $mysql_passwd, $mysql_db);
		$id = $mysql->real($_GET["id"]);
		$sql = "UPDATE LoginUser SET flag = 1 WHERE loginid = '$id'";
		$result = $mysql->query($sql, $link);
		//$del_number = $_POST["del"];
		//$del_number = mysql_real_escape_string($del_number);
		/*$temp = 0;
		$sql = "SELECT account, password, all_name, email FROM register where conferm = 0";
		$result = $mysql->query($sql, $link);
		while ($row = mysql_fetch_row($result)) {
			if ($temp == $del_number) {
				$sql = "insert into login_user values (NULL, '$row[0]', '$row[1]', '2', '0', '$row[2]')";
				$mysql->query($sql, $link);*/
				//e-mail start
				/*$to = $row[3];
				$subject = '神餐廳註冊完成通知信';
				$msg = '您好：<br /><br />感謝您註冊神餐廳<br />您的帳號為:'.$row[0].'<br />此帳號已經開通使用<br />請到<a href="http://hashman.no-ip.org/android/login.php">登入頁面</a>進行登入<br /><br />神餐廳感謝您的使用';
				$headers = 'From: coosos@me.com';
				if (mail($to, $subject, $msg, $headers))
					echo '信件發送成功';
				else
					echo '信件發送失敗';*/
				//end
				/*$sql = "update register set conferm = '1' where account = '$row[0]'";
				$mysql->query($sql, $link);
				break;
			}
			$temp++;
		}*/
		header("location:list.php");
	}
?>
